package group6renderer.renderernode;

import group6renderer.Display;
import group6renderer.Visitor;

public class HeadingNode extends LeafNode{

	private String heading;
	
	
	public HeadingNode(String heading)
    {
		this.heading=heading;
	}
 
    @Override
    public void drawNode(Display disp)
    {
    	disp.getState().setHeading(getHeadingLevel());
    }

    @Override
    public boolean hasClosing()
    {
	  return false;
    }

    @Override
    public TreeNode copy()
    {
	return new HeadingNode(heading);
    }

    @Override
    public void accept(Visitor theVisitor)
    {
	theVisitor.visit(this);
    }

    public int getHeadingLevel()
    {
    	  int asciiForZero=48;
    	return heading.charAt(1)-asciiForZero;	  
    }
}
